<?php
/**
 * Created by PhpStorm.
 * User: zhangjian37
 * Date: 2016/9/5
 * Time: 12:51
 */

$RootDir = $_SERVER['DOCUMENT_ROOT'];
include $RootDir.'/utils/mysql/MysqlUtils.php';

#当用户请求时，返回用户 "求助" 信息详情数据
#通过helpid得到helpinfo
$helpid = $_POST['helpid'];

$infoHelpEditRecord = new InfoHelpEditRecord();

$conn = conn_mysql();

$query = "select u.uname,h.publish_time,h.type,h.content,h.image1,h.image2,h.image3 from helpinfo h JOIN user_info u where h.userid = u.userid and h.help_id = '$helpid'";
$result = queryRecord($query,$conn);
while ($row=mysql_fetch_array($result, MYSQL_ASSOC)) {
    $infoHelpEditRecord -> publishStatus = $row['uname'];
    $infoHelpEditRecord -> publishtime = $row['publish_time'];
    $infoHelpEditRecord -> type = $row['type'];
    $infoHelpEditRecord -> content = $row['content'];
    $infoHelpEditRecord -> image1 = $row['image1'];
    $infoHelpEditRecord -> image2 = $row['image2'];
    $infoHelpEditRecord -> image3 = $row['image3'];
    break;
}

echo json_encode($infoHelpEditRecord);
